<?php

include dirname(__DIR__) . '/vendor/autoload.php';

$path  = __DIR__ . DIRECTORY_SEPARATOR . 'demo.json';
$text  = file_get_contents($path);
$input = json_decode($text, true);


// 校验:
$rule     = [
    // 'realname' => 'r|zh|bt:2,5',
    // 'nickname' => 'r|w|bt:6,20',
    // 'birthday' => 'r|date:Y-m-d|birthday',
    'address1'    => 'arr',
    'address2'    => 'object',
    'tags'    => 'arr',
];
$messages = [
    'name.r'     => ':field 必须填写!!!',
    'name.w'     => ':field 是英文字母和数字!!!',
    'uid.unique' => ':field 的值必须是唯一的值',
];

// 校验
vv($input, $rule, $messages, true);
// 结果
if (!vp()) {
    var_dump(ve(true));
} else {
    echo "pass\n";
}